package sentity

import (
	"path/filepath"
	"server/application/db/schema/dbops"
	"time"
)

type Trip struct {
	ID uint `gorm:"primarykey;comment:ID" json:"id"`
	//用户ID
	AccountId        uint      `gorm:"column:account_id;comment:用户ID" json:"account_id"`
	Days             uint      `gorm:"column:days;comment:旅行天数" json:"days"`
	StartSite        string    `gorm:"column:start_site;comment:出发地点;type:varchar(100)" json:"start_site"`
	EndSite          string    `gorm:"column:end_site;comment:目的地点;type:varchar(100)" json:"end_site"`
	Remark           string    `gorm:"column:remark;comment:旅行备注;type:varchar(255);default:null" json:"remark,omitempty"`
	PlaceDataJson    string    `gorm:"column:place_data_json;comment:线路json数据;type:longtext" json:"place_data_json,omitempty"`
	ItemDataDataJson string    `gorm:"column:item_data_json;comment:物品json数据;type:longtext" json:"item_data_json,omitempty"`
	CreatedAt        time.Time `gorm:"column:created_at;comment:创建时间" json:"created_at,omitempty"`
	UpdatedAt        time.Time `gorm:"column:updated_at;comment:更新时间" json:"updated_at,omitempty"`
}

// GenConfig 生成相关配置
func (t Trip) GenConfig() dbops.EntityConfig {
	return dbops.EntityConfig{
		Title:             "旅行",
		AsName:            "",                    //实体别名，请使用大驼峰命名法
		ViewsFatherFolder: filepath.Join("trip"), //视图父目录
		TableName:         "trips",
	}
}

// 表名
func (Trip) TableName() string {
	return "trips"
}
